package com.grapro.visitorsystem.utils.json;

import com.grapro.visitorsystem.entity.JsonResult;

public class JsonUtil {

    // success
    public static JsonResult ok() {
        return ok(null);
    }
    public static JsonResult ok(Object data) {
        return ok("解析成功", data);
    }
    public static JsonResult ok(String msg, Object data) {
        return new JsonResult(0, msg, data);
    }

    // failed
    public static JsonResult error() {
        return error("解析失败");
    }
    public static JsonResult error(String msg) {
        return error(-1, msg);
    }
    public static JsonResult error(int code, String msg) {
        return  new JsonResult(code, msg, null);
    }

}
